//
//  NSString+file.h
//  weibo
//
//  Created by apple on 13-8-28.
//  Copyright (c) 2013年 itcast. All rights reserved.
//  字符串扩展方法

#import <Foundation/Foundation.h>

@interface NSString (File)


//- (NSString *)URLEncodedString;

//字符串拼接
- (NSString *)filenameAppend:(NSString *)append;

+ (BOOL)isCodeValid:(NSString*)code;

//用户名验证
+(BOOL)isUserNameValid:(NSString*)name;

//用户密码验证
+(BOOL)isUserPasswordValid:(NSString*)password;

//电子邮箱验证
+(BOOL)isEmailValid:(NSString*)email;


//身份证号码
+(BOOL)checkIdentityCardNo:(NSString*)cardNo;

+ (BOOL)checkCodeValid:(NSString *)code;

//过滤中文
-(BOOL)isChinese;
//不能含有中文
- (BOOL)includeChinese;

//过滤英文
- (BOOL)isEnglishNum;

//过滤数字
-(BOOL)isNumber;

//密码强度验证
+(NSString *)checkPasswordStrength:(NSString*)password;

//密码强度验证
+(NSString *)checkPasswordStrength2:(NSString*)password;

//URL转码
- (NSString *)URLEncodeString;

//URL解码
- (NSString *)URLDecodeString;

-(id)JSONValue;


//返回JSON格式字符串
+ (NSString *)stringWithDict:(NSDictionary *)dict;

+ (NSString *)stringWithArray:(NSArray *)array;

//返回uuid
+ (NSString *)getTenUuids;
//比较两个时间大小
- (int)junc_CompareOneDateStr:(NSString *)oneDateStr withAnotherDateStr:(NSString *)anotherDateStr;
//计算两个时间差
+ (NSTimeInterval )dateTimeDifferenceWithStartTime:(NSString *)startTime endTime:(NSString *)endTime;


//获取当前时间 yyyyMMdd
+ (NSString *)getCurrentDate;
// 校验银行卡号
+(BOOL)isBankNumValid:(NSString*)num;
//获取当前时间
+(NSString *)getCurrentTime;
+ (NSString *)getCurrentDate2;
+ (NSString *)getDateString3;
+ (NSString *)getDateString:(NSDate *)date;
+ (NSString *)getDateString2;
//获取当前分段时间
+ (NSString *)getCurrentYearString;

+ (NSString *)getCurrentMounthString;

+ (NSString *)getCurrentDataString;



+ (void)getBgnYM:(NSString **)bgnYM andEndYM:(NSString **)endYM containDay:(BOOL)contain;

//获取当前日期 yyyymmdd
+ (NSString *)transDate;

//获取交易流水号 生成规则 02+yyyymmddhhmmss+8位随机数
+ (NSString *)serialNo;

//保存文件
+ (UIImage *)saveTempFileFromUrlString:(NSString *)urlString;

+ (NSString *)xmlstringWithDict:(NSDictionary *)dict;

+ (NSString *)xmlstringWithDict:(NSDictionary *)dict attributes:(NSArray *)attArr;

//截取字节字符
- (NSString *)subCharStringToIndex:(NSInteger)index;

//拼出文件路径
- (NSString *)documentAppend;

//md5加密
- (NSString *)md5;

/**
 *  转换为Base64编码
 */
- (NSString *)base64EncodedString;
/**
 *  将Base64编码还原
 */
- (NSString *)base64DecodedString;


+ (NSString *)encodeToPercentEscapeString:(NSString *)input;

+(NSString*)translateArab:(NSMutableString*)arab;

+ (NSString *)md5:(NSString *)inPutText;

+(BOOL)istwoPoint:(NSString *)two;

//返回 小时差 1位小数
+ (NSString *)gettimeIntervalSincepttrcTime:(NSString *)pttrcTime prtrcTime:(NSString *)prtrcTime;

+ (NSString *)stringWithNumber:(NSNumberFormatterStyle)style number:(NSNumber *)number;

+ (NSString *)getIPAddress;

+ (NSDictionary *)parseJSONStringToNSDictionary:(NSString *)JSONString;

- (NSString *)requestConfigTime;

- (NSString *)setupDisplayTime;
/**
 *返回值是该字符串所占的大小(width, height)
 *font : 该字符串所用的字体(字体大小不一样,显示出来的面积也不同)
 *maxSize : 为限制改字体的最大宽和高(如果显示一行,则宽高都设置为MAXFLOAT, 如果显示为多行,只需将宽设置一个有限定长值,高设置为MAXFLOAT)
 */
-(CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize;


//判断手机号码格式是否正确
+ (BOOL)valiMobile:(NSString *)mobile;

- (BOOL)isPureInt:(NSString*)string;

//判断是否输入了表情
+ (BOOL)stringContainsEmoji:(NSString *)string;
//最新的手机正则验证.
- (BOOL)isMobileNumber:(NSString *)mobileNum;

//判断终端号是否正确
+ (BOOL)valiGunCode:(NSString *)gunCode;

//车牌号验证
-(BOOL)validateCarNo:(NSString*)carNo;

/**
 *  金额字段加千位分隔符方法
 */
+ (NSString *)separatedDigitStringWithStr:(NSString *)digitString;


@end
